import bus from "@/bus";

let data = {
  form: {
    activitySn: '',
    activityType: null,
    skuId: '',
    spuId: ''
  },
  status: 'pass',
  totalItem: 1,
  pageSize: window.$pageSize,
  currentPage: 1,
  columns: [{
    title: '促销编码',
    key: 'activitySn',
    align: 'left',
    minWidth: 180
  }, {
    title: '活动名称',
    key: 'activityName',
    align: 'left',
    minWidth: 200
  }, {
    title: "促销时间",
    key: "date",
    align: "left",
    minWidth: 320,
    render: (h, params) => {
      let row = params.row
      let arr1 = row.promotionTimesDescription && row.promotionTimesDescription.split(',')
      let arr = (arr1 || []).map(item => {
        return h('p', item)
      })
      return h('div', [arr])
    }
  }, {
    title: '促销类型',
    key: 'promotionTypeDescription',
    align: 'left',
    minWidth: 100
  }, {
    title: "促销信息",
    key: "promotionRuleDescription",
    align: 'left',
    minWidth: 200
  }, {
    title: "促销状态",
    key: "statusText",
    align: 'left',
    minWidth: 100
  }, {
    title: "操作",
    key: "operate",
    align: 'right',
    minWidth: 100,
    render: (h, params) => {
      const row = params.row;
      let passBtn = h("Button", {
        props: {
          size: "small",
          type: 'primary'
        },
        on: {
          click: () => {
            window.$router.push({
              name: "sales/detail",
              query: {
                id: row.id,
                type: row.activityTypeEnum
              }
            });
          }
        }
      }, row.checkStatusEnum === 'UNCHECKED' ? '审核' : '查看');
      return h("div", [passBtn]);
    }
  }],
  data: []
}

export default data;